package com.zz.jdk8.algo;

/**
 * @author zhr
 */
public class Fib {
    public static void main(String[] args) {

        long fib0 = 0;
        long fib1 = 0;
        for(long i = 1; i < 50; i++) {
            System.out.print(fib(i) + " ");
            if(i % 10 == 0) {
                System.out.println();
            }
        }
        System.out.println();
        System.out.println("end");
    }

    private static long fib(long n) {
        if(n < 1) {
            return 0;
        } else if(n == 1 || n == 2) {
            return 1;
        }
        return fib(n - 2) + fib(n - 1);
    }
}
